package com.hckjsec.common.config;


import com.hckjsec.common.enums.BdIdCardEnum;
import com.hckjsec.common.utils.EnumUtil;
import com.hckjsec.common.utils.StringUtils;
import org.json.JSONObject;

import java.util.Hashtable;

public class BdIdCardResult {
    public BdIdCardResult(){
    };

    public BdIdCardResult(String editTool){
        this.message = BdIdCardEnum.IDCARD_EDIT.getValue() + editTool;
        this.status = BdIdCardEnum.IDCARD_EDIT.getKey();
    };

    public BdIdCardResult(String status,String type){
        this.message = "";
        this.status = StringUtils.isHcNull(status,"");
        if(this.status.equals(BdIdCardEnum.IDCARD_STATUS_NORMAL.getKey()) && type.equals(BdIdCardEnum.IDCARD_STATUS_NORMAL.getKey())) {
            this.message = BdIdCardEnum.IDCARD_STATUS_NORMAL.getValue();
        }else {
            Hashtable<String, Hashtable<String, String>> idCardStateHt = EnumUtil.enum2HT(BdIdCardEnum.class,"key");

            if(!this.status.equals(BdIdCardEnum.IDCARD_STATUS_NORMAL.getKey())) {
                this.message = idCardStateHt.get(this.status).get("value");
            }
            if(!type.equals(BdIdCardEnum.IDCARD_STATUS_NORMAL.getKey())) {
                if(this.message.equals("")) {
                    this.message += idCardStateHt.get(type).get("value");
                }else {
                    this.message += "、" + idCardStateHt.get(type).get("value");
                }
            }
        }
    }

    private BdIdCardFrontResult frontInfo;

    private BdIdCardBack backInfo;

    private String status;

    private String message;

    private String idPhoto;


    public BdIdCardFrontResult getFrontInfo() {
        return frontInfo;
    }

    public void setFrontInfo(JSONObject idCardInfo) {
        this.frontInfo = new BdIdCardFrontResult(idCardInfo);
    }

    public BdIdCardBack getBackInfo() {
        return backInfo;
    }

    public void setBackInfo(JSONObject idCardInfo) {
        this.backInfo = new BdIdCardBack(idCardInfo);
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getIdPhoto() {
        return idPhoto;
    }

    public void setIdPhoto(String idPhoto) {
        this.idPhoto = idPhoto;
    }
}
